<%--
  Created by IntelliJ IDEA.
  User: 10352
  Date: 2022/8/17
  Time: 10:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="AddServlet">
<table border="1">
    <tr>
        <th>添加组织机构信息</th>
    </tr>
    <tr>
        <td>组织机构名称（*）</td>
        <td><input type="text" name="name" id="name"></td>
    </tr>
    <tr>
        <td>负责人（*）</td>
        <td><input type="text" name="principaName" id="principaName"></td>
    </tr>
    <tr>
        <td>创建日期（*）</td>
        <td><input type="text" name="createDete" id="createDete"></td>
    </tr>
    <tr>
        <td>
            <input type="submit" value="提交">
            <input type="button" onclick="history.back()" value="返回">
        </td>
    </tr>
</table>
</form>
<script src="js/jquery-1.8.3.min.js"></script>
<script>
    $("form").submit(function(){
        var name = $("#name").val();
        var principaName = $("#principaName").val();
        var createDete = $("#createDete").val();

        if (name == "" && principaName == "" && createDete == "") {
            alert("请填写完整的组织机构信息信息!")
            return false;
        }

            dateFormat = new RegExp(/^\d{4}\-\d{2}\-\d{2}$/);
            if (!dateFormat.test($("#createDete").val())) {
                alert("日期格式不正确")
                return false;
            }
        })

</script>
</body>
</html>
